HTML 77.2%
TypeScript 10.5%
Python 9.6%
JavaScript 2.5%
1import { ImageResponse } from 'next/og';2import { Fallback, Wallpaper } from '@/components/brand/og';3import { fmtScoreUnit } from '@/components/models/shared';4import { apiD1, safe } from '@/lib/api';5import { fmtInt } from '@/lib/format';6import { routes, SITE_NAME } from '@/lib/site';78export const runtime = 'nodejs';9export const alt = `Benchmark leaderboard on ${SITE_NAME}`;10export const size = { width: 1200, height: 630 };11export const contentType = 'image/png';1213/** Benchmark OG: "Current recorded leader: X (score)" + results · models · metric · trust. */14export default async function BenchmarkOgImage({ params }: { params: Promise<{ slug: string }> }) {15 const { slug } = await params;16 const [d, list] = await Promise.all([safe(apiD1.benchmark(slug)), safe(apiD1.benchmarks())]);17 if (!d) return new ImageResponse(<Fallback label="Benchmark" />, { ...size });18 const item = list?.items.find((b) => b.slug === d.slug || b.id === d.id) ?? null;19 const leader = item?.leader ?? d.leaderboard?.[0] ?? null;20 const counters: [string, string][] = [];21 counters.push(['Results', fmtInt(item?.result_count ?? d.result_count ?? 0)]);22 counters.push(['Models', fmtInt(item?.model_count ?? d.model_count ?? 0)]);23 if (d.metric ?? item?.metric) counters.push(['Metric', `${d.metric ?? item?.metric} ${(d.direction ?? item?.direction) === 'lower' ? '↓' : '↑'}`]);24 if (leader) counters.push(['Leader score', fmtScoreUnit(leader.score, leader.unit)]);25 const subtitle = leader ? `Current recorded leader: ${leader.model.name}${leader.model.organization ? ` (${leader.model.organization.name})` : ''} — ${leader.trust_label ?? leader.trust_level}` : 'No results recorded yet — sources being connected.';26 return new ImageResponse(<Wallpaper eyebrow={`Benchmark${d.category ? ` · ${d.category}` : ''}${d.variant && d.variant !== 'main' ? ` · ${d.variant}` : ''}`} title={d.name} subtitle={subtitle} counters={counters.slice(0, 4)} footer={`www.ai-atlas.co${routes.benchmark(d.slug)}`} markPx={220} />, { ...size });27}28